package tco11.round2;

public class GuessTheNumberGame {

    public int possibleClues(int n) {
        boolean isComposite[] = new boolean[n + 1];
        final int MOD = 1000000007;
        
        long ans = 1;

        for (int i = 2; i <= n; i++) {
            if (!isComposite[i]) {
                long p = 1, total = 0;
                while (i * p <= n) {
                    p *= i;
                    total++;
                }
                ans = (ans * (total + 1)) % MOD;
                for (int x = i + i; x <= n; x += i) {
                    isComposite[x] = true;
                }
            }
        }
        return (int) ans;
    }

    // BEGIN KAWIGIEDIT TESTING
    // Generated by KawigiEdit 2.1.8 (beta) modified by pivanof
    private static boolean KawigiEdit_RunTest(int testNum, int p0, boolean hasAnswer, int p1) {
        System.out.print("Test " + testNum + ": [" + p0);
        System.out.println("]");
        GuessTheNumberGame obj;
        int answer;
        obj = new GuessTheNumberGame();
        long startTime = System.currentTimeMillis();
        answer = obj.possibleClues(p0);
        long endTime = System.currentTimeMillis();
        boolean res;
        res = true;
        System.out.println("Time: " + (endTime - startTime) / 1000.0 + " seconds");
        if (hasAnswer) {
            System.out.println("Desired answer:");
            System.out.println("\t" + p1);
        }
        System.out.println("Your answer:");
        System.out.println("\t" + answer);
        if (hasAnswer) {
            res = answer == p1;
        }
        if (!res) {
            System.out.println("DOESN'T MATCH!!!!");
        } else if ((endTime - startTime) / 1000.0 >= 2) {
            System.out.println("FAIL the timeout");
            res = false;
        } else if (hasAnswer) {
            System.out.println("Match :-)");
        } else {
            System.out.println("OK, but is it right?");
        }
        System.out.println("");
        return res;
    }

    public static void main(String[] args) {
        boolean all_right;
        all_right = true;

        int p0;
        int p1;

        // ----- test 0 -----
        p0 = 5;
        p1 = 12;
        all_right = KawigiEdit_RunTest(0, p0, true, p1) && all_right;
        // ------------------

        // ----- test 1 -----
        p0 = 16;
        p1 = 240;
        all_right = KawigiEdit_RunTest(1, p0, true, p1) && all_right;
        // ------------------

        // ----- test 2 -----
        p0 = 1;
        p1 = 1;
        all_right = KawigiEdit_RunTest(2, p0, true, p1) && all_right;
        // ------------------

        // ----- test 3 -----
        p0 = 1000000;
        p1 = 677298706;
        all_right = KawigiEdit_RunTest(3, p0, true, p1) && all_right;
        // ------------------

        if (all_right) {
            System.out.println("You're a stud (at least on the example cases)!");
        } else {
            System.out.println("Some of the test cases had errors.");
        }
    }
    // END KAWIGIEDIT TESTING
}
//Powered by KawigiEdit 2.1.8 (beta) modified by pivanof!
